<template>
  <div class="app-container">
    <div class="big_box">

      <div class="leftbox">
        <el-card shadow="hover">

          <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-position="right">
            <el-form-item label="手牌号" prop="handBrand" label-width="60px">
              <el-input
                v-model="queryParams.handBrand"
                clearable
                placeholder="请输入手牌号"
                @keyup.enter.native="checkH"
              />
            </el-form-item>

              <!--<el-button class="querya" type="primary" icon="el-icon-search" size="mini" @click="checkH">读牌-->
              <el-button class="querya" type="primary" @click="checkH">读牌</el-button>

          </el-form>

          <div class="mx_box">
            <el-tabs v-model="activeName">
              <el-tab-pane label="消费明细" name="first">
                <div>
                  <el-table
                    :row-style="rowStyle"
                    :cell-class-name="tableRowClassName"
                    :data="tableData" border style="width: 100%" height="620">
                    <el-table-column prop="handBrand" label="手牌号" width="150px"></el-table-column>
<!--                    <el-table-column prop="userId" label="工号"></el-table-column>-->
                    <el-table-column prop="entryName" label="项目名称"></el-table-column>
                    <el-table-column prop="projectCategory" label="项目类别" width="150px">
                      <template slot-scope="scope">
                        <dict-tag :options="dict.type.yqg_project_category" :value="scope.row.projectCategory"/>
                      </template>
                    </el-table-column>
                    <el-table-column prop="consumptionStatus" label="消费状态" width="100px">
                      <template slot-scope="scope">
                        <dict-tag :options="dict.type.yqg_consumption_status" :value="scope.row.consumptionStatus"/>
                      </template>
                    </el-table-column>
                    <el-table-column prop="quantity" label="数量" width="80px"></el-table-column>
                    <el-table-column prop="unitPrice" label="单价" width="120px"></el-table-column>
                    <!--                      <el-table-column prop="totalAmount" label="合计" width="80px"></el-table-column>-->
                    <el-table-column label="操作" width="120px">
                      <template slot-scope="scope">
<!--                        <el-button-->
<!--                          size="mini"-->
<!--                          type="text"-->
<!--                          @click="handleUpdate(scope.row)">-->
<!--                          &lt;!&ndash;            v-hasPermi="['system:borrow:query']"&ndash;&gt;-->
<!--                          修改-->
<!--                        </el-button>-->
                        <el-button type="warning" plain @click="jianshao(scope.row.index)">减少</el-button>
                      </template>
                    </el-table-column>
                  </el-table>
                  <!-- 退单对话框 -->
                  <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
                    <el-form ref="form" :model="form" :rules="rules" label-width="100px">

                      <el-form-item label="消费状态" prop="consumptionStatus">
                        <el-select v-model="form.consumptionStatus" placeholder="请选择消费状态" style="width: 270px">
                          <el-option
                            v-for="dict in dict.type.yqg_consumption_status"
                            :key="dict.value"
                            :label="dict.label"
                            :value="dict.value"
                          ></el-option>
                        </el-select>
                      </el-form-item>

                      <!--                        <el-form-item label="退单时间" prop="chargebackTime">-->
                      <!--                          <el-date-picker clearable-->
                      <!--                                          v-model="form.chargebackTime"-->
                      <!--                                          type="date"-->
                      <!--                                          style="width: 270px"-->
                      <!--                                          value-format="yyyy-MM-dd"-->
                      <!--                                          placeholder="请选择退单时间">-->
                      <!--                          </el-date-picker>-->
                      <!--                        </el-form-item>-->
                      <el-form-item label="商品数量" prop="quantity">
                        <el-col :span="18">
                          <el-input v-model="form.quantity" placeholder="请输入数量" width="60"/>
                        </el-col>
                      </el-form-item>
                      <el-form-item label="退单原因" prop="reasonForChargeback">
                        <el-col :span="18">
                          <el-input v-model="form.reasonForChargeback" placeholder="请输入退单原因"/>
                        </el-col>
                      </el-form-item>
                      <el-form-item label="处理人工号" prop="chargebackProcessorAccount">
                        <el-col :span="18">
                          <el-input v-model="form.chargebackProcessorAccount" placeholder="请输入退单处理人账号"/>
                        </el-col>
                      </el-form-item>
                      <el-form-item label="处理人姓名" prop="chargebackProcessorName">
                        <el-col :span="18">
                          <el-input v-model="form.chargebackProcessorName" placeholder="请输入退单处理人姓名"/>
                        </el-col>
                      </el-form-item>

                    </el-form>
                    <div slot="footer" class="dialog-footer">
                      <el-button type="primary" @click="submitForm">确 定</el-button>
                      <el-button @click="cancel">取 消</el-button>
                    </div>
                  </el-dialog>
                </div>
              </el-tab-pane>
            </el-tabs>
          </div>
        </el-card>
      </div>


      <!--          打印小票-->
      <div class="shaodrawer" style="z-index: -9999;position: fixed;top: -10000px;left: 0;width: 200mm">
        <div class="drawerleft">
          <div id="printAre" class="lyqxiaopiaocard" :data="tableData1" >
  <span style="margin-top:10px;text-align: left;font-size: 40px;font-family: '楷体', KaiTi, serif;" >
    玉泉宫欢迎您!
  </span>
<!--            <div style="margin-top:1px;border-top: 4px solid #ccc;"></div>-->

            <table  style="width: 100%;" >
              <tr>
                <td style="text-align: center;font-family: '楷体';width: 20%">项目名称</td>
<!--                <td style="text-align: center;font-family: '楷体';">数量</td>-->
                <td style="text-align: center;font-family: '楷体';width: 20%">单价</td>
                <td style="text-align: center;font-family: '楷体';width: 20%">合计</td>
                <td style="text-align: center;font-family: '楷体';width: 20%">时间</td>
              </tr>
              <tr v-for="rows in tableData1" >
                <td  style="text-align: center;font-family: '楷体';width: 20%">{{rows.entryName}}</td>
<!--                <td style="text-align: center;font-family: '楷体';">{{rows.quantity}}</td>-->
                <td style="text-align: center;font-family: '楷体';width: 20%">{{rows.unitPrice}}x{{rows.quantity}}</td>
                <td style="text-align: center;font-family: '楷体';width: 20%">{{rows.totalAmount}}元</td>
                <td style="text-align: center;font-family: '楷体';width: 20%">{{currentTime}}</td>
              </tr>
            </table>

<!--            <div style="margin-top:1px;border-top: 4px solid #ccc;"></div>-->
            <div style="font-family: '楷体'" >当前日期:{{currentDate}}</div>
            <div style="font-family: '楷体'" >当前时间:{{currentTime}}</div>
            <div style="font-family: '楷体'" >地址:锦州市凌河区玉泉宫</div>
            <div style="font-family: '楷体'" >电话:1234567890</div>

          </div>
<!--          <div id="printAre" class="lyqxiaopiaocard" :data="tableData1" style="text-align: left" >-->
<!--            <div style="margin-top:10px;text-align: center" >-->
<!--              玉泉宫欢迎您！-->
<!--            </div>-->
<!--            <div style="margin-top:6px;border-top: 4px solid #ccc;"></div>-->
<!--            <span style="float: left;">下单时间:{{currentDateTime}}</span>-->

<!--            <div style="margin-top:30px;border-top: 4px solid #ccc;"></div>-->
<!--            <span class="mingcheng">名称</span>-->
<!--            <span class="shuliang">数量</span>-->
<!--            <span style="float: right;">金额</span>-->
<!--            <div  v-for="rows in tableData1">-->
<!--              <el-row :gutter="10">-->
<!--                <el-col :span="16">-->
<!--                  <span >{{rows.entryName}}</span>-->
<!--                </el-col>-->
<!--                <el-col :span="2">-->
<!--                  <span >{{rows.quantity}}</span>-->
<!--                </el-col>-->
<!--                <el-col :span="2">-->
<!--                  <span class="xiaopiaocontent1">{{rows.totalAmount}}</span>-->
<!--                </el-col>-->
<!--              </el-row>-->

<!--            </div>-->
<!--            <div style="margin-top:10px;border-top: 4px solid #ccc;"></div>-->
<!--            <div class="dibu1">操作员:</div>-->
<!--            &lt;!&ndash;                <div class="dibu1">地址:辽宁省锦州市凌河区靖东街杏花里13号玉泉宫温泉洗浴会馆</div>&ndash;&gt;-->
<!--            <div class="dibu1">电话:1234567890</div>-->
<!--          </div>-->
        </div>
      </div>


      <div class="rightbox">
        <el-card shadow="hover">
          <div class="mx_box1">
            <div>

              <el-form :inline="true" :model="form1" ref="form1" class="demo-form-inline" label-position="right">
                <el-form-item label="桌号：" label-width="60px">
                  <el-input type="text" class="rule-input-edit" readonly v-model="form1.tableNumber"></el-input>
                </el-form-item>
                <el-form-item label="时间：" label-width="60px">
                  <el-input type="text" class="rule-input-edit" readonly v-model="form1.phoneTime"></el-input>
                </el-form-item>
              </el-form>

              <el-table class="buju" :data="tableDateTemp" border show-summary :summary-method="getSummaries"
                        style="width: 100%" height="570">
                <!--                  <el-table-column prop="projectCode" label="代码" ></el-table-column>-->

                <el-table-column prop="entryName" label="名称"></el-table-column>
                <!--                  <el-table-column prop="mnemonicCode" label="助记码"></el-table-column>-->
                <el-table-column prop="quantity" label="数量"></el-table-column>
                <el-table-column prop="unitPrice" label="单价"></el-table-column>
                <el-table-column prop="totalAmount" label="合计"></el-table-column>
              </el-table>
              <br>
            </div>


            <div class="buju1">
              <el-form :model="queryParams1" ref="queryForm1" size="small" :inline="true" label-position="right">
                <el-form-item label="单号" prop="orderNumber" label-width="60px">
                  <el-input
                    v-model="queryParams1.orderNumber"
                    clearable
                    placeholder="请输入单号"
                    @keyup.enter.native="handleQuery1"
                  />
                </el-form-item>
                <el-button class="querya" type="primary"   @click="handleQuery1">查询</el-button>
                <el-button class="querya" type="primary"   @click="trans();getCurrentTime2()">录入</el-button>
                <el-button class="querya" type="primary"   @click="handleAdd1">下单</el-button>
              </el-form>

              <!--                <el-form :model="queryParams2" ref="queryForm2" size="small" :inline="true" label-position="right">-->
              <!--                <el-form-item label="工号" prop="userId" label-width="60px">-->
              <!--                  <el-input-->
              <!--                    v-model="queryParams2.userId"-->
              <!--                    clearable-->
              <!--                    placeholder="请输入工号"-->
              <!--                  />-->
              <!--                </el-form-item>-->
              <!--                  <br>-->
              <!--                  <el-form-item label="手牌号" prop="handBrand" label-width="60px">-->
              <!--                    <el-input-->
              <!--                      v-model="queryParams3.handBrand"-->
              <!--                      clearable-->
              <!--                      placeholder="请输入手牌号"-->
              <!--                    />-->
              <!--                  </el-form-item>-->


              <!--                </el-form>-->

            </div>

            <!--              <div >-->
            <!--                <el-button class="button" type="primary" plain @click="handleQuery1" >查询</el-button>-->
            <!--              </div>-->
            <!--              <div >-->
            <!--                <el-button class="button" type="primary" plain @click="handleAdd" >录入</el-button>-->
            <!--              </div>-->

          </div>
        </el-card>
      </div>

    </div>
  </div>

</template>

<script>
import {listDetails, addDetails, delDetails, getDetails, updateDetails} from "@/api/module/lyq/details";
import {listOrdering, getOrdering, delOrdering, updateOrdering} from "@/api/module/lyq/ordering";
import {listHands, getHands} from "@/api/module/lyq/hands";
import {listBills} from "@/api/module/lyq/bills";
import {checkHand, getUserId} from "@/api/module/wtc/hands";
import printJS from "print-js";

export default {
  name: "index",
  dicts: ['yqg_hand_category', 'yqg_hand_state', 'yqg_payment_method', 'yqg_consumption_status', 'yqg_retention_status', 'yqg_project_category', 'yqg_post', 'yqg_check_out_status', 'yqg_department', 'yqg_merge_status', 'yqg_sailings_signs', 'yqg_next_clock_status'],
  data() {
    return {
      currentDate: new Date().toLocaleDateString(),
      currentTime: '',
      // 遮罩层
      loading: true,
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 时间
      shijian: this.getCurrentTime(),
      billsList: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 100,
        userId: null,
        deptId: null,
        department: null,
        nickName: null,
        userName: null,
        post: null,
        handBrand: null,
        handCategory: null,
        handState: null,
        retentionStatus: null,
        mergeStatus: null,
        openingTime: null,
        drawTime: null,
        mergeHands: null,
        mergeBarBillsId: null,
        leaveTime: null,
        beforeLeave: null,
        beforeBarBillsId: null,
        entryName: null,
        projectCategory: null,
        projectCode: null,
        mnemonicCode: null,
        unit: null,
        unitPrice: null,
        commissionPrice: null,
        together: null,
        sailingsSigns: null,
        barBillsId: null,
        recordingTime: null,
        quantity: null,
        totalAmount: null,
        seat: null,
        orderNumber: null,
        paymentMethod: null,
        consumptionStatus: null,
        chargebackTime: null,
        reasonForChargeback: null,
        chargebackProcessorAccount: null,
        chargebackProcessorName: null,
        clockTime: null,
        nextClockTime: null,
        nextClockStatus: null,
        recordEmployeeNumber: null,
        recorderEmployeeName: null,
        roomType: null,
        openingHours: null,
        checkOutTime: null,
        checkOutStatus: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },

      queryParams1: {
        pageNum: 1,
        pageSize: 100,
        visitorId: null,
        tableNumber: null,
        entryName: null,
        projectCategory: null,
        firstLevelClassification: null,
        secondaryClassification: null,
        tertiaryClassification: null,
        projectCode: null,
        mnemonicCode: null,
        unit: null,
        unitPrice: null,
        quantity: null,
        orderNumber: null,
        phoneTime: null,
        totalAmount: null,
        status: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },

      queryParams2: {
        pageNum: 1,
        pageSize: 100,
        id: null,
        userId: null,
        deptId: null,
        nickName: null,
        userName: null,
        idNumber: null,
        sex: null,
        phone: null,
        post: null,
        department: null,
        personnelStatus: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null
      },

      queryParams3: {
        pageNum: 1,
        pageSize: 100,
        id: null,
        handBrand: null,
        handCategory: null,
        handState: null,
        lockedState: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null
      },

      queryParams4: {
        pageNum: 1,
        pageSize: 10,
        userId: null,
        deptId: null,
        nickName: null,
        department: null,
        userName: null,
        post: null,
        handBrand: null,
        originalHand: null,
        handCategory: null,
        retentionStatus: null,
        mergeStatus: null,
        handState: null,
        numberOfPeople: null,
        allCost: null,
        openingTime: null,
        groupId: null,
        oddNumbers: null,
        children: null,
        mastercard: null,
        handoverTime: null,
        handoverStatus: null,
        barNumber: null,
        sailings: null,
        together: null,
        note: null,
        groupNotes: null,
        discountAmount: null,
        checkoutTime: null,
        supplementaryConsumption: null,
        paidInAmount: null,
        paidInCash: null,
        changeAmount: null,
        paymentMethod: null,
        totalConsumptionAmount: null,
        cardiner: null,
        checkout: null,
        frontSign: null,
        frontPrintTime: null,
        operator: null,
        checkoutLocation: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null,
        note6: null,
        note7: null,
        note8: null,
        note9: null,
        note10: null
      },
      handParams: {
        handBrand: null,
        handCategory: null,
        handState: null,
        lockedState: null,
        note1: null,
        note2: null,
        note3: null,
        note4: null,
        note5: null
      },
      activeName: 'first',
      hand: '',
      userId: '',
      ordered: [],
      // 表单参数
      form: {},
      form1: {},
      // 表单校验
      rules: {},
      tableData: [],
      tableData1: [],
      tableDateTemp: [],
      tableData2: [],
      tableData3: [],
      tableData4: [],
      tableData5: [],
      tableData6: [],
      tableData7: []

    }
  },
  created() {
    // this.getDetailsList();
    // this.getOrderingList();
    // this.getbaseinfoList();
    // this.gethandsList();
    this.getCurrentTime();
    console.log("hand" + this.queryParams.handBrand)
  },
  methods: {
    jianshao(index){
      this.tableData[index].quantity-=1;
      // this.tableData[index].totalAmount= this.tableData[index].quantity * this.List1.unitPrice
      if(this.tableData[index].quantity==0){
        this.tableData.splice(index,1);
      }
    },
    // 表单重置
    reset() {
      this.queryParams1 = {
        orderNumber: null
      };
      this.queryParams2 = {
        userId: null
      };
      this.queryParams3 = {
        handBrand: null
      };
      // this.resetForm("form");
      this.tableData = []
      this.hand = ''
      this.tableDateTemp = []
      this.form1 = {}
      this.ordered = []
    },
    //获取当前时间
    getCurrentTime2() {
      const date = new Date();
      // const year = date.getFullYear();
      // const month = date.getMonth() + 1; // 注意月份从0开始，需要加1
      // const day = date.getDate();
      const hours = date.getHours();
      const minutes = date.getMinutes();
      // const seconds = date.getSeconds();
      const h = String(hours).padStart(2, '0');
      const m = String(minutes).padStart(2, '0');
      // const s = String(seconds).padStart(2, '0');
      this.currentTime = `${h}:${m}`;
    },



    //录入按钮
    handleAdd1() {
      // if (this.hand == null || this.hand === '') {
      //   this.$modal.msgError("请先读牌");
      // } else if (this.queryParams1.orderNumber == null || this.queryParams1.orderNumber === '') {
      //   this.$modal.msgError("请输入单号");
      // } else {
      if (this.tableData1.length === 0) {
        this.$modal.msgError("请先查询单号");
      } else {
        this.queryParams4.handBrand = this.hand;
        console.log("ceshi"+this.hand)
        this.queryParams4.handState = 1
        listBills(this.queryParams4).then(response => {
          this.billsList = response.rows;
          if (this.billsList.length === 0) {
            this.$modal.msgError("此手牌未开牌");
          } else {
            this.queryParams3.handBrand = this.hand
            listHands(this.queryParams3).then(response => {
              this.handsList = response.rows;
              if (this.handsList[0].lockedState === '0') {
                this.$modal.msgError("此手牌号已被锁定");
              } else {
                if (this.tableData.length === 0) {
                  this.$modal.msgError("未录单不能下单");
                }
                else {
                  for (var i = 0; i < this.tableData1.length; i++) {
                    this.tableData1[i].status = 1;
                    updateOrdering(this.tableData1[i]);
                    this.tableData1[i].recordingTime = new Date().getTime();
                    this.tableData1[i].handBrand = this.queryParams.handBrand;
                    // this.tableData1[i].userId=this.queryParams2.userId;
                    this.tableData1[i].consumptionStatus = 0;
                    this.tableData1[i].handoverStatus = 0;
                    // this.tableData1[i].totalAmount=this.tableData1[i].quantity*this.tableData1[i].unitPrice;
                    console.log(this.tableData1[i].totalAmount);
                    addDetails(this.tableData1[i]).then(response => {
                      this.reset();
                      // this.getDetailsList();
                    });
                  }
                  this.$modal.msgSuccess(this.queryParams.handBrand + "下单成功");
                  this.queryParams.handBrand = ''

                  const style='@page{margin:0 1mm};'

                  printJS({
                    printable: printAre, // 'printFrom', // 标签元素id
                    type: 'html',
                    targetStyles: ['*'],
                    page_size:"auto",
                    style
                  })
                }

              }

            });


          }
        });


        // }

      }


    },

    // //消费详情删除按钮
    // handleDelete(row) {
    //   const ids = row.id || this.ids;
    //   this.$modal.confirm('是否确认删除此条点餐记录').then(function() {
    //     return delDetails(ids);
    //   }).then(() => {
    //     this.getDetailsList();
    //     this.$modal.msgSuccess("删除成功");
    //   }).catch(() => {});
    // },
    // //点单暂存删除按钮
    // handleDelete1(row) {
    //   const ids = row.id || this.ids;
    //   this.$modal.confirm('是否确认删除此条点餐记录').then(function() {
    //     return delOrdering(ids);
    //   }).then(() => {
    //     this.getOrderingList();
    //     this.$modal.msgSuccess("删除成功");
    //   }).catch(() => {});
    // },
    //消费详情修改按钮
    handleUpdate(row) {
      // this.reset();
      const id = row.id || this.ids
      getDetails(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改消费详细";
      });
    },

    //手牌号搜索按钮操作
    handleQuery() {
      this.queryParams.pageNum = 1;
      if (this.queryParams.handBrand == null || this.queryParams.handBrand === '') {
        this.$modal.msgError("请输入手牌号");
      } else {
        // this.getDetailsList();
        this.checkH()
      }
    },

    //判断手牌号
    checkH() {
      this.handParams.handBrand = this.queryParams.handBrand
      checkHand(this.handParams).then(res => {
        this.hand = this.handParams.handBrand
        this.$modal.msgSuccess(this.handParams.handBrand + "读牌成功");
      })
    },

    // 订单录入到手牌（不入库）
    trans() {
      // this.tableData = this.tableData1

      if (this.hand == null || this.hand === '') {
        this.$modal.msgError("请先读牌");
      } else if (this.queryParams1.orderNumber == null || this.queryParams1.orderNumber === '') {
        this.$modal.msgError("请输入单号");
      } else if (this.ordered.includes(this.queryParams1.orderNumber)) {
        this.$modal.msgError("相同单号不能重复录入");
        this.tableDateTemp = []
        this.form1 = {}
        this.queryParams1 = {
          orderNumber: null
        }
      } else if (this.ordered.length !== 0) {
        this.$modal.msgError("一次只能录入一个单号");
        this.tableDateTemp = []
        this.form1 = {}
        this.queryParams1 = {
          orderNumber: null
        }
      } else {

        this.ordered.push(this.queryParams1.orderNumber)
        if (this.tableDateTemp.length === 0) {
          this.$modal.msgError("请先查询单号");
        } else {
          // getUserId().then(res=>{
          //   this.userId = res
          // })
          for (let i = 0; i < this.tableDateTemp.length; i++) {
            this.tableData.push({
              userId: this.userId,
              handBrand: this.hand,
              entryName: this.tableDateTemp[i].entryName,
              projectCategory: this.tableDateTemp[i].projectCategory,
              unitPrice: this.tableDateTemp[i].unitPrice,
              quantity: this.tableDateTemp[i].quantity,
              consumptionStatus: this.tableDateTemp[i].status,
            })
          }
          console.log("00000000000000")
          console.log(this.tableData)
          this.tableDateTemp = []
          this.form1 = {}
          this.queryParams1 = {
            orderNumber: null
          }
        }
      }
    },

    //单号搜索按钮操作
    handleQuery1() {
      this.queryParams1.pageNum = 1;
      this.queryParams1.status = 0;
      if (this.queryParams1.orderNumber == null || this.queryParams1.orderNumber === '') {
        this.$modal.msgError("请输入单号");
      } else if (this.ordered.length !== 0) {
        this.$modal.msgError("一次只能录入一个单号");
        this.tableDateTemp = []
        this.form1 = {}
        this.queryParams1 = {
          orderNumber: null
        }
      } else {
        this.getOrderingList()
      }

    },

    // // 重置按钮操作
    // resetQuery() {
    //   this.resetForm("queryForm");
    //   this.reset();
    // },

    //输入手牌号获取用户点餐信息
    getDetailsList() {

      this.queryParams.handState = 1;
      this.queryParams.projectCategory = '04';
      listDetails(this.queryParams).then(response => {
        this.tableData4 = response.rows;

        this.queryParams.handState = 1;
        this.queryParams.projectCategory = '06';
        listDetails(this.queryParams).then(response => {
          this.tableData5 = response.rows;
          this.tableData6 = this.tableData4.concat(this.tableData5)

          this.queryParams.handState = 1;
          this.queryParams.projectCategory = '09';
          listDetails(this.queryParams).then(response => {
            this.tableData7 = response.rows;
            this.tableData = this.tableData6.concat(this.tableData7)

          });
        });
      });


    },

    //录入单号获取点餐信息
    getOrderingList() {
      this.loading = true;
      listOrdering(this.queryParams1).then(response => {
        this.tableData1 = response.rows;
        this.tableDateTemp = this.tableData1
        if (response.rows.length === 0) {
          this.form1.tableNumber = null;
          this.form1.phoneTime = null;
          this.$modal.msgError("当前单号不可用");
        } else {
          this.form1.tableNumber = response.rows[0].tableNumber;
          this.form1.phoneTime = this.filterTime(response.rows[0].phoneTime);
        }
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 提交按钮
    submitForm() {
      if (this.form.consumptionStatus === 1) {
        if (this.form.chargebackProcessorAccount == null || this.form.chargebackProcessorName == null) {
          this.$modal.msgError("请输入处理人信息");
        } else {
          this.form.chargebackTime = new Date().getTime();
          updateDetails(this.form).then(response => {
            this.$modal.msgSuccess("修改成功");
            this.open = false;
            this.getDetailsList();
          });
        }
      } else {
        updateDetails(this.form).then(response => {
          this.$modal.msgSuccess("修改成功");
          this.open = false;
          this.getDetailsList();
        });
      }


    },

    //获取当前时间并打印
    getCurrentTime() {
      var _this = this;
      let yy = new Date().getFullYear();
      let mm = new Date().getMonth() + 1;
      let dd = new Date().getDate();
      let hh = new Date().getHours();
      let mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes();
      let ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds();
      let s = yy + '-' + mm + '-' + dd + ' ' + hh + ':' + mf + ':' + ss;
      return s;
      console.log(s)

    },

    //将中国标准时间转换为时分秒
    filterTime(time) {
      var date = new Date(time);
      var y = date.getFullYear();
      var m = date.getMonth() + 1;
      m = m < 10 ? "0" + m : m;
      var d = date.getDate();
      d = d < 10 ? "0" + d : d;
      var h = date.getHours();
      h = h < 10 ? "0" + h : h;
      var minute = date.getMinutes();
      minute = minute < 10 ? "0" + minute : minute;
      var s = date.getSeconds();
      s = s < 10 ? "0" + s : s;
      return y + "-" + m + "-" + d + " " + h + ":" + minute + ":" + s;
    },
    // 获取点击行的索引
    tableRowClassName({ row, rowIndex }) {
      row.index = rowIndex;
    },
    rowStyle(row, rowIndex){
      if (this.currentRowId === row.id) {
        // 此处返回选中行的样式对象，按需设置
        return {
          'background-color': 'rgba(94,180,251,0.18)',
          'color': 'rgb(47,46,46)'
        }
      }
    },

    //指定列求和
    getSummaries(param) {
      const {columns, data} = param;
      const sums = [];
      //第一列命名合计
      columns.forEach((column, index) => {
        if (index === 0) {
          sums[index] = '合计';
          return;
        }
        const values = data.map(item => Number(item[column.property]));
        //指定allCompanyNum、allCarNum、allDriverNum不求和，其余列军求和
        if (column.property !== 'projectCode' && column.property !== 'entryName' && column.property !== 'mnemonicCode'
          && column.property !== 'quantity' && column.property !== 'unitPrice' && column.property !== 'c') {
          sums[index] = values.reduce((prev, curr) => {
            const value = Number(curr);
            if (!isNaN(value)) {
              return prev + curr;
            } else {
              return prev;
            }
          }, 0);
          sums[index];
        } else {
          sums[index] = ''
        }
      });
      return sums
    }
  }
}


</script>


<style lang="scss" scoped>
.buju {
  overflow: visible !important;
}

.buju1 {
  margin-top: 50px;
}

.querya {
  margin-left: 3%;
}

.big_box {
  display: flex;
  height: 100%;
}

.leftbox {
  width: 60%;
  height: 750px;
}

.rightbox {
  margin-left: 10px;
  width: 40%;
  height: 750px;
}

.mx_box {
  height: 700px;
  margin: auto
}

.mx_box1 {
  height: 750px;
  margin: auto
}

.rule-input-edit ::v-deep {
  .el-input__inner {
    border: 0;
    border-radius: 0px;

    &:focus {
      border-bottom: 0px solid #409eff;
    }
  }
}
//.lyqxiaopiaocard{
//  margin-left: 20px;
//  font-size: 20px;
//  height: 600px;
//  width: 80%;
//  /*边框*/
//  border: solid 1px rgba(102, 146, 191, 0.68);
//  /*边角弧度*/
//  border-radius: 10px;
//}
.lyqxiaopiaocard{
  font-size: 20px;
  height: 600px;
  width: 100%;
}
.xiaopiaocontent1{
  margin-left: 30px;
}
.drawerleft {
  float: left;
  width: 40%;
}

.shaodrawer {
  width: 100%;
}
</style>
